<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/style.css" />
		<script type="text/javascript" src="js/js.js" ></script>
		<script src="https://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
		<script>
			function submitAndCheck(){
				if (!checkPassword())
					return;
				$.ajax({
					url : '../AdminServlet',
					method : 'post',
					data : {
						'operation' : 'add',
						'username' : $('#username').val(),
						'password' : $('#password').val()
					},
					dataType : 'json',
					success : function(json) {
						alert('添加成功！');
						window.location='admin.html';
					}
				});
			}
		</script>
	</head>
	<body>
	<form>
		<div class="main">
			<div class="title">创建管理员</div>
			<div class="padding10_0">用户名</div> 
			<input id="username" type="text" class="input_text_mid" placeholder="至少2个字符" name="username" pattern="\w{2,}" required/>&nbsp;&nbsp;输入系统登录账号，至少2个字符
			<div class="padding10_0">密码</div>
			<input id="password" type="password" class="input_text_mid" placeholder="请输入密码" name="pwd" pattern="\w{6,}" required/>
			<div class="padding10_0">重复密码</div>
			<input type="password" class="input_text_mid" placeholder="请再次输入密码" name="repwd" pattern="\w{6,}" required/>
			<div class="padding10_0">
				<input type="button" value="创建" class="input_submit" onclick="submitAndCheck()"/>
				<input type="reset" value="重置" class="whitebutton"/>
				<input type="button" class="whitebutton" value="返回" onclick="history.back(-1)"/>
			</div>
		</div>
	</form>
	</body>
</html>
